import request from '@/utils/request';

/**
 * activity查询查询接口
 */
export async function activitySearch(data: API.ProfileSearchInfo, options?: API.baseOption) {
  return request<any>('/activity/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 券配置激活接口
 */
export async function profileActivate(
  data: { activityIds: string; resetRule?: boolean; type?: string },
  options?: API.baseOption,
) {
  return request<string>('/profile/activate', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 刷新缓存/coupon-config/activity/resetTask
 */
export async function resetTask(
  data: { activityIds?: string[]; type: string },
  options?: API.baseOption,
) {
  return request<string>('/activity/resetTask', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 2.3.10 activity转成批次管理 /coupon-config/activity/trans-batch
export async function transBatch(data: { activityId: string }, options?: API.baseOption) {
  return request<string>('/activity/trans-batch', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 修改权重值
export async function editSortid(
  data: { activityId: string; sortId: string },
  options?: API.baseOption,
) {
  return request<string>('/activity/edit-sortid', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 2.3.11 activity修改发放标签
export async function modifyNeedgenasynfile(
  data: { activityId: string; needgenasynfile: string },
  options?: API.baseOption,
) {
  return request<string>('/activity/modify-needgenasynfile', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 2.3.13 排序规则修改 /coupon-config/activity/edit-sortrule
export async function editSortrule(
  data: { activityId: string; sorttype: number; sortrule: string },
  options?: API.baseOption,
) {
  return request<any>('/activity/edit-sortrule', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 2.10.1 核对/coupon-config/couponinfocheck/check
export async function couponinfoCheck(
  data: { activityIds: string[]; checkCrossBrand?: boolean },
  options?: API.baseOption,
) {
  return request<any>('/couponinfocheck/check', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 2.10.2 导出/coupon-config/couponinfocheck/export
export async function couponinfoExport(data: { activityIds: string[] }, options?: API.baseOption) {
  return request<string>('/couponinfocheck/export', {
    responseType: 'blob',
    getResponse: true,
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 同步三方资产--开始
// 2.11.1  三方下拉/coupon-config/thirdpart/thirdpart-list
export async function thirdpartList(data: { brandId: string }, options?: API.baseOption) {
  return request<API.ThirdpartListItem[]>('/thirdpart/thirdpart-list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
// 三方资产内容下拉/coupon-config/thirdpart/thirdpart-asset
export async function thirdpartAsset(
  data: { thirdPartId: string; brandId: string },
  options?: API.baseOption,
) {
  return request<API.ThirdpartAssetItem[]>('/thirdpart/thirdpart-asset', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
// 2.11.4 资产查询/coupon-config/thirdpart/asset-detail
export async function assetDetail(data: { assetId: string }, options?: API.baseOption) {
  return request<API.AssetDetailItem>('/thirdpart/asset-detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
// 2.11.5 资产编辑/coupon-config/thirdpart/asset-edit
export async function assetEdit(data: API.AssetDetailItem, options?: API.baseOption) {
  return request<string>('/thirdpart/asset-edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
// 同步三方资产--结束
